home *** CD-ROM | disk | FTP | other *** search
- /*
- This is a bunch of the IFF stuff from the ROM Kernal Manual.
- */
-
- #define IFF_H 1
-
- #include <stdio.h>
- #ifndef EXEC_TYPES_H
- #include <exec/types.h>
- #endif
- #ifndef EXEC_MEMORY_H
- #include <exec/memory.h>
- #endif
- #ifndef INTUITION_INTUITION_H
- #include <intuition/intuition.h>
- #endif
- #ifndef INTUITION_SCREENS_H
- #include <intuition/screens.h>
- #endif
- #ifndef DEVICES_AUDIO_H
- #include <devices/audio.h>
- #endif
-
- #define SEEK_SET 0
-
-
-
- typedef struct
- {
- LONG ckID;
- LONG cksize;
- UBYTE *ckdata;
- }
- Chunk;
-
- typedef LONG ID;
-
- #define MakeID(a,b,c,d) ((LONG)(a)<<24 | (LONG)(b)<<16 | (c)<<8 | (d))
-
-
- #define ID_FORM MakeID('F','O','R','M') /* chunk types */
- #define ID_LIST MakeID('L','I','S','T')
- #define ID_PROP MakeID('P','R','O','P')
- #define ID_CAT MakeID('C','A','T',' ')
-
- #define ID_BMHD MakeID('B','M','H','D') /* sub-types */
- #define ID_BODY MakeID('B','O','D','Y') /* for IFF ILBMs */
- #define ID_CMAP MakeID('C','M','A','P')
- #define ID_GRAB MakeID('G','R','A','B')
- #define ID_DEST MakeID('D','E','S','T')
- #define ID_SPRT MakeID('S','P','R','T')
- #define ID_CAMG MakeID('C','A','M','G')
-
- #define ID_VHDR MakeID('V','H','D','R') /* for sound samples */
- #define ID_BODY MakeID('B','O','D','Y')
- #define ID_8SVX MakeID('8','S','V','X')
-
- typedef UBYTE Masking; /* more ILBM stuff */
-
- #define mskNone 0
- #define mskHasMask 1
- #define mskHasTransparentColor 2
- #define mskLasso 3
-
- typedef UBYTE Compression;
-
- #define cmpNone 0
- #define cmpByteRun1 1
-
- typedef struct
- {
- UWORD w,h; /* width, height */
- WORD x,y; /* pixel display position */
- UBYTE nplanes; /* number of bitplanes */
- Masking masking;
- Compression compression;
- UBYTE pad1; /* word-align next item */
- UWORD TransparentColor; /* transparent color... */
- UBYTE xAspect, yAspect; /* aspect ratio width:height */
- WORD pageWidth,pageHeight; /* source page size, in pixels */
- }
- BitMapHeader;
-
- typedef struct
- {
- UBYTE red, green, blue;
- }
- ColorRegister;
-
- typedef ColorRegister ColorMap[64];
-
- typedef struct
- {
- unsigned pad1 :4, red :4, green :4, blue :4;
- }
- Color4;
-
- typedef struct
- {
- WORD x,y;
- }
- Point2D;
-
- typedef struct
- {
- UBYTE depth; /* bitplanes in source image */
- UBYTE pad1;
- UWORD planePick;
- UWORD planeOnOff;
- UWORD planeMask;
- }
- DestMerge;
-
-
-
- #define LEFTA 0 /* these make it easier to keep track of which */
- #define LEFTB 2 /* sound channels you want to use. CONTROL is */
- #define RIGHTA 1 /* the channel used for doing volume changes */
- #define RIGHTB 3 /* and things like that. */
- #define CONTROL 4
-
- typedef struct
- {
- ULONG oneShotHiSamples;
- ULONG repeatHiSamples;
- ULONG samplesPerHiCycle;
- UWORD samplesPerSec;
- UBYTE ctoctave;
- UBYTE sCompression;
- LONG volume;
- }
- Voice8Header;
-
-
- struct ASound
- {
- Voice8Header vhead;
- ULONG datasize;
- BYTE *data;
- };
-
-
- #define NTSC_CLOCK 3579545L /* sound clock speeds */
- #define PAL_CLOCK 3546895L
-
-
- /*
- These variables are used to do sound stuff. The channels are the
- four audio channels IO requests plus one more to do starts, stops,
- volume changes, things like that.
- The whichsound[] array will always contain a pointer to the ASound
- structure currently playing for that channel. i.e. whichsound[0]
- will point to the ASound playing on channels[0]. They are put in
- the ifdef so that they are only included in iff_stuff.c, but not in
- other programs that use this header file. Here for reference mainly,
- since user programs should have no need to fiddle with these things
- directly.
- */
-
- #ifdef IFF_STUFF_C
- struct IOAudio *channels[5] = { NULL, NULL, NULL, NULL, NULL };
- struct ASound *whichsound[4] = { NULL, NULL, NULL, NULL };
- struct MsgPort *AudioPort = NULL;
- BYTE alloc_all_channels[] = { 0x01,0x02,0x04,0x08 };
- #endif
-
- typedef UWORD SpritePrecedence;
-
- /* for viewmodes and the CAMG chunk type */
-
- #define BADFLAGS (SPRITES|VP_HIDE|GENLOCK_AUDIO|GENLOCK_VIDEO)
- #define FLAGMASK (~BADFLAGS)
- #define CAMGMASK (FLAGMASK & 0x0000FFFFL)
-
-
- BOOL GetBMHD(FILE *ifffile,BitMapHeader *header);
- ULONG PullID(UBYTE *data);
- BOOL GetViewModes(struct NewScreen *newscreen,FILE *ifffile);
- BOOL FindChunk(FILE *ifffile,ULONG chunktype,Chunk *chunk);
- SHORT GetColorMap(FILE *ifffile,UWORD *colortable);
- BOOL ReadPic(struct BitMap *bitmap,FILE *ifffile,BitMapHeader *header);
- BOOL LoadPicture(FILE *file, struct BitMap *bitmap);
-
- BOOL OpenAudio();
- struct ASound *LoadSound(char *name);
- BOOL GetVoiceHeader(FILE *file,Voice8Header *vhead);
- void PlaySound(struct ASound *sound,SHORT loops,UWORD volume,SHORT channel);
- void FreeSound(struct ASound *sound);
- void WaitSounds(struct ASound *sound1,struct ASound *sound2,struct ASound *sound3,struct ASound *sound4);
- void WaitChannels(SHORT channelmask);
- void AbortAllSounds(void);
- void AbortSound(struct ASound *sound);
- void AbortChannel(int channel);
- void CloseAudio();
- void StartAudio();
- void StopAudio();
-